package dome4;

public class Main {
    public static void main(String[] args) {
        Dog dog = new Dog("小七", 15);
        Loin loin = new Loin("小八", 16);
        Animal animal = loin;
        animal.A();
        animal = dog;
        animal.A();
        if(animal instanceof Loin) {
            loin = (Loin) animal;
            loin.A();
        }
        if(animal instanceof Dog) {
            dog = (Dog) animal;
            dog.A();
        }
    }
}
